// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "KeyProgressWidget.generated.h"


DECLARE_MULTICAST_DELEGATE_OneParam(FProgressCompleted, bool);

UCLASS()
class MISCELLANEOUSPROJECT_API UKeyProgressWidget : public UUserWidget
{
	GENERATED_BODY()
public:
	virtual void NativeOnInitialized() override;
	virtual void NativeConstruct() override;
public:
	UFUNCTION(BlueprintCallable, Category = MissionComponent)
	void UpdateProgress(float TargetProgress = 0.f, float InSeconds = 1.f);
	void UpdateInteractionBar(float Value);
	float GetCurrentValue();
	void ProgressTimer();
public:
	UPROPERTY(meta = (BindWidget))
	class UBorder* Background;
	UPROPERTY(meta = (BindWidget))
	class UBorder* InteractInTime;
	UPROPERTY(meta = (BindWidget))
	class UTextBlock* KeyText;
public:
	FText Text;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default")
	FLinearColor TextInColor;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default")
	FLinearColor BackgroundInColor;
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default")
	FLinearColor ProgressInColor;
	FTimerHandle ProgressTimerHandle;
	FProgressCompleted OnProgressCompleted;
private:
	UMaterialInstanceDynamic* InteractInTimeMat;
	float TargetProgress;
	float TargetInSeconds;
	
	
};
